<include file="public/order_header"/>

<body>

<!--main-->
<style type="text/css">
body{ background:#f4f4f4;}
</style>
<div class="cpMain">

  <volist name="list" id="list">
    <div class="myOrder-item">
      <div class="myOrder-item-head clearfix">
        <span class="name fl">{$config['index_store_name']}</span>
        <span class="state c-orange fr">
          <if condition="$list.order_status eq -1">已取消</if>
          <if condition="$list.order_status eq 0">未支付</if>
          <if condition="$list.order_status eq 1">已支付</if>
          <if condition="$list.order_status eq 2">已完成</if>
        </span>
      </div>
      <div class="myOrder-item-list clearfix">

        <volist name="$list.order_goods" id="order_goods" offset="0" length="3">
          <dd>
            <div class="pic">
              <img src="{$order_goods.original_img}">
            </div>
            <div class="tit">
              {$order_goods.goods_name}
            </div>
          </dd>
        </volist>

        <div class="all">
          <div class="a-price">
            ￥<strong>{$list.goods_price}</strong>
          </div>
          <div class="a-num">
            共{:count($list.order_goods)}件
          </div>
        </div>
      </div>
      <div class="myOrder-item-again">
          <a href="javascript:;" class="again-btn" data-id="{$list.order_id}" onclick="del_meal_order(this)">删除订单</a>
        <a href="javascript:;" class="again-btn" onClick="again('{$list.order_id}')" >再来一单</a>
      </div>
    </div>
  </volist>

</div>
<!--main End--> 

<!--footer-->
<include file="public/order_footer"/>
<!--footer End-->

<script>
  function again(item_id){
      $.ajax({
          type : "POST",
          url:"/home/order/again.html",//+tab,
          data : {item_id:item_id},// 你的formid
          success: function(data){
              if (data.status == 200){
                  if (data.url) {window.location.href = data.url;}
              }
          }
      });
  }
  
  function del_meal_order(obj){
      layer.confirm('确认删除？', function () {
      	var item_id = $(obj).attr('data-id');
          $.ajax({
              type: 'post',
              url: '/home/order/del_meal_order.html',
              data : {item_id:item_id},// 你的formid
              dataType: 'json',
              success: function (data) {
                  if (data.status == 200) {
                  	layer.msg(data.msg,{icon:1,time:2000},function(){if(data.url){ window.location.href = data.url;}});
                  } else {
                      layer.msg(data.msg,{icon:2,time:2000},function(){if(data.url){ window.location.href = data.url;}});
                  }
              }
          })
      });
  }
</script>

</body>
</html>
